<template>
  <div>
  <el-breadcrumb separator-class="el-icon-arrow-right">
    <el-breadcrumb-item :to="route.path" v-for="route in routes" :key="route.path">{{route.name}}</el-breadcrumb-item>
  </el-breadcrumb>
  </div>
</template>

<script>
export default {
  name: 'abc',
  data () {
    return {
      routes: []
    }
  },
  created () {
    console.log(this.$route)
    const matched = this.$route.matched
    const arr = []
    matched.forEach(item => {
      const path = item.meta.pathname || item.path
      const name = item.meta.name
      arr.push({ path, name })
    })
    arr[arr.length - 1].path = ''
    console.log('路由对象', arr)
    // 下一步遍历并且放到elementui的面包屑中
    this.routes = arr
  }
}
</script>

<style>

</style>
